<?php
	class BaseAction extends CommonAction {
		private $bs;
		function __construct(){
			parent::__construct();
			$this->bs=new  BaseSetModel();
		}
		function sysinfo(){
			$sysinfo=new SysInfoModel();
			$this->assign("sysinfo", $sysinfo->getSysInfos());	
			$this->assign("tmess", '可以根据网站的需要，对服务器现有的配置进行调整.');
			$this->display("admin/base/sysInfo.tpl");
		} 
		function baseset(){
			$this->assign("tmess", '水印文字为两行,一般设为自己的网站版权较为合适,支持中文. 图片尺寸无特殊要求使用默认值为最佳尺寸. ');
			$varList=$this->bs->getSet();
			$this->assign("varList",$varList);


			$this->display("admin/base/baseSet.tpl");
		}
		
		function edit(){
			$varList=$this->bs->getSet();
			$this->message(1, "配置文件修改成功！");
			$this->assign("varList",$varList);	
			$this->display("admin/base/baseSet.tpl");
		}


		function set(){
			$error=false;
			if($this->bs->validateForm($_POST)){
				if($this->bs->writeConfig("config.inc.php",$_POST)){
					$error=false;
				}else{
					$error=true;
				}
			}else{
				$error=true;
			}

			if($error){
				$this->message(0, $this->bs->getMessList());
				global $styleList;
				$_POST["selectStyle"]=$styleList;
				$_POST["waterpath"]=GALLERY_PATH;
				$_POST["water"]=WATER;
				$this->assign("varList", $_POST);
				$this->display("admin/base/baseSet.tpl");
			}else{
				$this->redirect("admin.php","base","edit");
			}
	
			
		}
		function upcatch(){
			$this->message(1,"缓存更新成功！");
			$this->clear_all_cache();
			$this->display("admin/base/upcache.tpl");
		}
	}
